import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/login/index.vue"),
    meta: {
      fullscreen: true,
    },
  },
  {
    path: "/main",
    name: "main",
    redirect: "/main/all",
    meta: {
      key: "main",
    },
    children: [
      {
        path: "/main/all",
        name: "all",
        component: () => import("@/views/main/index.vue"),
        meta: {
          key: "main",
        },
      },
      {
        path: "/main/video",
        name: "video",
        component: () => import("@/views/main/index.vue"),
        meta: {
          key: "main",
        },
      },
      {
        path: "/main/radio",
        name: "radio",
        component: () => import("@/views/main/index.vue"),
        meta: {
          key: "main",
        },
      },
      {
        path: "/main/image",
        name: "image",
        component: () => import("@/views/main/index.vue"),
        meta: {
          key: "main",
        },
      },
      {
        path: "/main/document",
        name: "document",
        component: () => import("@/views/main/index.vue"),
        meta: {
          key: "main",
        },
      },
      {
        path: "/main/other",
        name: "other",
        component: () => import("@/views/main/index.vue"),
        meta: {
          key: "main",
        },
      },
    ],
  },
  {
    path: "/share",
    name: "share",
    component: () => import("@/views/share/index.vue"),
    meta: {
      key: "share",
    },
  },
  {
    path: "/recycle",
    name: "recycle",
    component: () => import("@/views/recycle/index.vue"),
    meta: {
      key: "recycle",
    },
  },
  {
    path: "/setting",
    name: "setting",
    component: () => import("@/views/setting/index.vue"),
    redirect: "/setting/user",
    meta: {
      key: "setting",
    },
    children: [
      {
        path: "/setting/user",
        name: "user",
        component: () => import("@/views/setting/index.vue"),
        meta: {
          key: "setting",
        },
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
